package com.senlingspace.common.enums;

/**
 * 拉卡拉支付交易状态枚举
 *
 * @author lebronjames
 * @date 2024/07/24
 */
public enum LakalaTradeStateEnum {

    INIT("初始化"),
    CREATE("下单成功"),
    SUCCESS("交易成功"),
    FAIL("交易失败"),
    DEAL("交易处理中"),
    UNKNOWN("未知状态"),
    CLOSE("订单关闭"),
    PART_REFUND("部分退款"),
    REFUND("全部退款(或订单被撤销)");

    private final String description;

    LakalaTradeStateEnum(String description) {
        this.description = description;
    }

    public String getDescription() {
        return description;
    }

    public static LakalaTradeStateEnum fromState(String status) {
        for (LakalaTradeStateEnum state : LakalaTradeStateEnum.values()) {
            if (state.name().equalsIgnoreCase(status)) {
                return state;
            }
        }
        throw new IllegalArgumentException("Unknown state: " + status);
    }

}
